# Execute simple git command tasks.
def run_git(d, cmd):
    try:
        root = d.getVar('COREBASE', True)
        return bb.process.run(("export PSEUDO_DISABLED=1; " +
                               "git --work-tree %s --git-dir %s/.git %s")
            % (root, root, cmd))[0].strip('\n')
    except Exception as e:
        bb.warn("Unexpected exception from 'git' call: %s" % e)
        return 'unkonwn'


DIRTY_VERSION := "${@run_git(d, ' describe --always --tags --dirty')}"
